package com.fy.core.exception;

import com.fy.core.vo.ApiRest;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author hxd
 * @version 1.0
 * @ClassName ExceptionHandler
 * @date 2023/6/13 21:51
 * @since 1.0
 */
@ControllerAdvice
@ResponseBody
public class ExceptionResolver {
    @ExceptionHandler(ServiceException.class)
    public ApiRest handler(ServiceException exception){
        return ApiRest.failure(exception.getMsg(),"");
    }
}
